package cn.bdqn.mallmgr.controller.rec;

import cn.bdqn.mallmgr.service.CategoryService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;


@Controller
public class IndexController {
    @Resource
    private CategoryService categoryService;

    //首页  分类+商品信息

    @GetMapping("/index")
    @ResponseBody
    public String index() {
        HashMap<String, Object> result = new HashMap<>();
        result.put("result", categoryService.getAllCategories());
        return JSONArray.toJSONString(result);
    }
}
